package com.lvcoding.jwtdemo.util;

import lombok.AllArgsConstructor;
import lombok.Data;

@AllArgsConstructor
@Data
public class Res {

    private int code;
    private String msg;
    private Object data;

    public static Res success() {
        return new Res(200, "请求成功", null);
    }

    public static Res success(Object data) {
        return new Res(200, "请求成功", data);
    }

    public static Res fail() {
        return new Res(500, "请求失败", null);
    }

    public static Res fail(int code, String msg, Object data) {
        return new Res(code, msg, data);
    }

    public static Res fail(Object data) {
        return new Res(500, "请求失败", data);
    }
}
